package com.homestead.controller;

import com.homestead.bo.AddOrgBo;
import com.homestead.controller.req.AddOrgRequest;
import com.homestead.resp.CommonResponse;
import com.homestead.service.CouponApplicableOrgService;
import com.homestead.utils.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author HanBin_Yang
 * @since 2021/5/30 9:27
 */
@RestController
@RequestMapping("/adaptOrg")
@Api(tags = {"券配置适用组织"})
public class ApplicableOrgController {
    @Autowired
    private CouponApplicableOrgService applicableOrgService;

    @ApiOperation("添加组织")
    @PostMapping("/add")
    public CommonResponse<Boolean> add(@RequestBody AddOrgRequest in) {
        AddOrgBo bo = in.convert();
        applicableOrgService.add(bo);
        return CommonResponseUtil.success();
    }
}
